/*
 * @Author: lijunqing
 * @Date: 2024-04-22 15:39:13
 * @LastEditors: lijunqing
 * @LastEditTime: 2024-04-22 15:58:26
 * @Description:
 */
const fs = require("fs");
const express = require("express");
const morgan = require("morgan");

// 创建app对象
const app = express();
// 应用第三方中间件

const writeStream = fs.createWriteStream("./logs/access.log", {
  flags: "a",
});

app.use(morgan("combined", { stream: writeStream }));

// 编写中间件
app.post("/login", (req, res, next) => {
  res.end("登录成功, 欢迎回来~");
});

// 启动服务器
app.listen(3000, () => {
  console.log("express服务器启动成功~");
});
